import request from '@/config/axios'

// 站点 VO
export interface WebsiteVO {
  id: number // 主键
  domain: string // 域名
  description: string // 网站描述
  title: string // 网站标题
  icon: string // icon
  copyright: string // 版权
  keywords: string // 关键词
}

// 站点 API
export const WebsiteApi = {
  // 查询站点分页
  getWebsitePage: async (params: any) => {
    return await request.get({ url: `/cms/website/page`, params })
  },

  // 查询站点详情
  getWebsite: async (id: number) => {
    return await request.get({ url: `/cms/website/get?id=` + id })
  },

  // 新增站点
  createWebsite: async (data: WebsiteVO) => {
    return await request.post({ url: `/cms/website/create`, data })
  },

  // 修改站点
  updateWebsite: async (data: WebsiteVO) => {
    return await request.put({ url: `/cms/website/update`, data })
  },

  // 删除站点
  deleteWebsite: async (id: number) => {
    return await request.delete({ url: `/cms/website/delete?id=` + id })
  },

  // 导出站点 Excel
  exportWebsite: async (params) => {
    return await request.download({ url: `/cms/website/export-excel`, params })
  },
  // 导出站点 Excel
  getWebsiteByTenantId: async () => {
    return await request.get({ url: `/cms/website/getWebsiteByTenantId` })
  },
  insertOrUpdate: async (data: WebsiteVO) => {
    return await request.post({ url: `/cms/website/insertOrUpdate`, data })
  },
}
